﻿<navigation:Page x:Class="CRM.Tools.MetadataBrowser.Views.EntityList" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:local="clr-namespace:CRM.Tools.MetadataBrowser.Helpers"
                 xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
                 xmlns:layout="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit"
                 
           d:DesignWidth="840" d:DesignHeight="480"
           Title="Entity List"
           Style="{StaticResource PageStyle}">

    <UserControl.Resources>
        <local:ObjectConverter x:Key="ConvertObject" />
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="30" ></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Background="DarkGray" Height="30" >
            <Button Name="uxExport" Click="Export_Click" Content="Export to Excel" Width="120" Height="25" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="2" />

        </StackPanel>
        
        <data:DataGrid Grid.Row="1" AutoGenerateColumns="False" HorizontalAlignment="Stretch"  Name="uxData" IsReadOnly="True" VerticalContentAlignment="Top">
            <data:DataGrid.ColumnHeaderStyle>
                <Style x:Name="AngleHeader"  TargetType="primitives:DataGridColumnHeader" >
                    <Setter Property="FontSize" Value="12" />
                    <Setter Property="FontWeight" Value="Bold"  />
                    <Setter Property="Margin" Value="0" />
                    <Setter Property="Padding" Value="2" />
                    <Setter Property="VerticalContentAlignment" Value="Bottom" />
                    <Setter Property="Height" Value="140" />
                    <Setter Property="ContentTemplate" >
                        <Setter.Value>
                            <DataTemplate >
                                <layout:LayoutTransformer>
                                    <layout:LayoutTransformer.LayoutTransform>
                                        <RotateTransform Angle="-35"/>
                                    </layout:LayoutTransformer.LayoutTransform>
                                    <TextBlock Text="{Binding}" TextWrapping="Wrap"   />
                                </layout:LayoutTransformer>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

            </data:DataGrid.ColumnHeaderStyle>

                <data:DataGrid.Columns>
               
                <data:DataGridTemplateColumn  Header="Logical Name" CanUserSort="True" SortMemberPath="LogicalName" x:Name="LogicalName">
                    
                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>         
                            <HyperlinkButton Click="LogicalName_Click" Content="{Binding LogicalName, Converter={StaticResource ConvertObject}}"  FontFamily="Arial" FontSize="12"  VerticalAlignment="Center" Margin="4"   />
                            
                        </DataTemplate>
                        
                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>
                <data:DataGridTextColumn Header="Logical Name" Binding="{Binding LogicalName, Converter={StaticResource ConvertObject}}" Visibility="Collapsed" />

                <data:DataGridTextColumn Header="Schema Name" Binding="{Binding SchemaName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Display Name" Binding="{Binding DisplayName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Display Collection Name" Binding="{Binding DisplayCollectionName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Object Type Code" Binding="{Binding ObjectTypeCode}" />
                <data:DataGridTextColumn Header="Ownership Type" Binding="{Binding OwnershipType, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Description" Binding="{Binding Description, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Primary Id Attribute" Binding="{Binding PrimaryIdAttribute, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Primary Name Attribute" Binding="{Binding PrimaryNameAttribute, Converter={StaticResource ConvertObject}}" />
                
                <data:DataGridCheckBoxColumn Header="Is Custom Entity" Binding="{Binding IsCustomEntity, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Customizable" Binding="{Binding IsCustomizable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Activity" Binding="{Binding IsActivity, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Managed" Binding="{Binding IsManaged, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Audit Enabled" Binding="{Binding IsAuditEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Available Offline" Binding="{Binding IsAvailableOffline, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Child Entity" Binding="{Binding IsChildEntity, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Connections Enabled" Binding="{Binding IsConnectionsEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Document Management Enabled" Binding="{Binding IsDocumentManagementEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Duplicate Detection Enabled" Binding="{Binding IsDuplicateDetectionEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Enabled For Charts" Binding="{Binding IsEnabledForCharts, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Importable" Binding="{Binding IsImportable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Intersect" Binding="{Binding IsIntersect, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Mail Merge Enabled" Binding="{Binding IsMailMergeEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Mappable" Binding="{Binding IsMappable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Renameable" Binding="{Binding IsRenameable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Reading Pane Enabled" Binding="{Binding IsReadingPaneEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Valid For Advanced Find" Binding="{Binding IsValidForAdvancedFind, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Valid For Queue" Binding="{Binding IsValidForQueue, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Visible In Mobile" Binding="{Binding IsVisibleInMobile, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Be In Many To Many" Binding="{Binding CanBeInManyToMany, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Be Primary Entity In Relationship" Binding="{Binding CanBePrimaryEntityInRelationship, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Be Related Entity In Relationship" Binding="{Binding CanBeRelatedEntityInRelationship, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Attributes" Binding="{Binding CanCreateAttributes, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Charts" Binding="{Binding CanCreateCharts, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Forms" Binding="{Binding CanCreateForms, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Views" Binding="{Binding CanCreateViews, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Modify Additional Settings" Binding="{Binding CanModifyAdditionalSettings, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Trigger Workflow" Binding="{Binding CanTriggerWorkflow, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Auto Route To Owner Queue" Binding="{Binding AutoRouteToOwnerQueue, Converter={StaticResource ConvertObject}}" />

                <data:DataGridTextColumn Header="Recurrence Base Entity Logical Name" Binding="{Binding RecurrenceBaseEntityLogicalName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Icon Large Name" Binding="{Binding Path=IconLargeName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Icon Medium Name" Binding="{Binding Path=IconMediumName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Icon Small Name" Binding="{Binding Path=IconSmallName, Converter={StaticResource ConvertObject}}" />

                <data:DataGridTextColumn Header="Activity Type Mask" Binding="{Binding ActivityTypeMask, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Metadata Id" Binding="{Binding MetadataId, Converter={StaticResource ConvertObject}}" />

            </data:DataGrid.Columns>
           
            
        </data:DataGrid>



    </Grid>
</navigation:Page>
